EM

[Resolvido] colocar exaustão nesse item

Por Emooooo, 31 de mar. de 2019 em Resolvidos

7
1.8k
EmoooooE
31 de março de 2019 às 14:11

colocar exaustão de 1 hora para poder usar novamente !

 

 

 

+rep 

CrypterC
01 de abril de 2019 às 00:12
local outfits = {"rat", "ghost", "chicken", "pig"} -- outfits (randomicos)
local duration = 45 -- tempo de duraçao dos outfits (em segundos)
local breakchance = 90 --chance de perder a varinha magica

local exhaustion_time = 1 * * 60 * 60
local exhaustion_storage = 109000

function onUse(cid, item, fromPosition, itemEx, toPosition)
	
	if not isPlayer(itemEx.uid) then
		doPlayerSendCancel(cid, "Use only on players.")
		return true
	elseif exhaustion.check(cid, exhaustion_storage) then
		doPlayerSendCancel(cid, "Wait " .. exhaustion.get(cid, exhaustion_storage) .. " seconds.")
		return true
	end
	
	if math.random(100) <= breakchance then
		local pos = getClosestFreeTile(cid, toPosition, true, false)
		if isWalkable(pos) then
			doSummonCreature("Mad Sheep", pos)
			doSendMagicEffect(pos, CONST_ME_SOUND_BLUE)
		end
		doRemoveItem(item.uid, 1)
	else
		doSetMonsterOutfit(itemEx.uid, outfits[math.random(#outfits)], duration * 1000)
		doSendMagicEffect(toPosition, CONST_ME_MAGIC_BLUE)
	end
	
	exhaustion.set(cid, exhaustion_storage, exhaustion_time)
	return true
end

 

EmoooooE
01 de abril de 2019 às 16:39
16 horas atrás, Crypter disse:
local outfits = {"rat", "ghost", "chicken", "pig"} -- outfits (randomicos)
local duration = 45 -- tempo de duraçao dos outfits (em segundos)
local breakchance = 90 --chance de perder a varinha magica

local exhaustion_time = 1 * * 60 * 60
local exhaustion_storage = 109000

function onUse(cid, item, fromPosition, itemEx, toPosition)
	
	if not isPlayer(itemEx.uid) then
		doPlayerSendCancel(cid, "Use only on players.")
		return true
	elseif exhaustion.check(cid, exhaustion_storage) then
		doPlayerSendCancel(cid, "Wait " .. exhaustion.get(cid, exhaustion_storage) .. " seconds.")
		return true
	end
	
	if math.random(100) <= breakchance then
		local pos = getClosestFreeTile(cid, toPosition, true, false)
		if isWalkable(pos) then
			doSummonCreature("Mad Sheep", pos)
			doSendMagicEffect(pos, CONST_ME_SOUND_BLUE)
		end
		doRemoveItem(item.uid, 1)
	else
		doSetMonsterOutfit(itemEx.uid, outfits[math.random(#outfits)], duration * 1000)
		doSendMagicEffect(toPosition, CONST_ME_MAGIC_BLUE)
	end
	
	exhaustion.set(cid, exhaustion_storage, exhaustion_time)
	return true
end

 

[01/04/2019 12:06:25] [Error - LuaScriptInterface::loadFile] data/actions/scripts/tools/spellwand.lua:5: unexpected symbol near '*'
[01/04/2019 12:06:25] [Warning - Event::loadScript] Cannot load script (data/actions/scripts/tools/spellwand.lua)
[01/04/2019 12:06:25] data/actions/scripts/tools/spellwand.lua:5: unexpected symbol near '*'

gabriel28G
01 de abril de 2019 às 18:56

@Emooooo
Troca:

local exhaustion_time = 1 * * 60 * 60

Por:
local exhaustion_time = 1 * 60 * 60

EmoooooE
01 de abril de 2019 às 19:10
13 minutos atrás, gabriel28 disse:

@Emooooo
Troca:

local exhaustion_time = 1 * * 60 * 60

Por:
local exhaustion_time = 1 * 60 * 60

[01/04/2019 19:09:39] [Error - LuaScriptInterface::loadFile] data/actions/scripts/tools/spellwand.lua:5: unexpected symbol near 'ï'
[01/04/2019 19:09:39] [Warning - Event::loadScript] Cannot load script (data/actions/scripts/tools/spellwand.lua)
[01/04/2019 19:09:39] data/actions/scripts/tools/spellwand.lua:5: unexpected symbol near 'ï'

gabriel28G
01 de abril de 2019 às 19:17
Melhor resposta

@Emooooo
Parece que quando você colou lá, trocou por um caractere especial. Reescreve 'exhaustion_time' no script e fica atento se não tem nenhum outro caractere especial. 

Yan LiimaY
01 de abril de 2019 às 20:41
A questão neste tópico de suporte foi respondida e/ou o autor do tópico resolveu o problema. Este tópico está fechado e foi movido para Suporte - Resolvidos. Se você tiver outras dúvidas, crie um novo tópico.